<% use_page_title "#{dynamic_view_type.name.demodulize.titleize.pluralize}" %>
<%= render layout: 'page_title' do %>
    <%= link_to "Add", new_engine_aware_path(dynamic_view_type), class: 'btn btn-primary btn-small right' %>
<% end %>
<%= render layout: 'main_content' do %>
  <table class="data cms-content-table table table-striped table-bordered table-hover">
	<thead>
		<tr>
	      <th>Name</th>
          <th>Path</th>
	      <th>Updated At</th>
	      <th>Actions</th>
	    </tr>
	</thead>
    <% @views.each do |view| %>
      <tr>
        <td><%= view.display_name %></td>
        <td><%= view.path %></td>
        <td><%= view.updated_at && view.updated_at.to_s(:date) %></td>
        <td>
          <%= link_to "Edit", edit_polymorphic_path(view), class: "btn btn-mini" %>
          <%= link_to "Delete", polymorphic_path(view), class: "btn btn-mini btn-danger", method: 'delete',  data: {confirm: 'Are you sure you want to delete this view?'} %>
        </td>
      </tr>
    <% end %>
  </table>
<% end %>
<% if @views.size == 0 && params[:key_word]%>
  <div class="pagination">No results found for '<%= params[:key_word] %>'</div>
<% elsif @views.total_pages > 1 %>
  <%= render_pagination @views, dynamic_view_type %>
<% end %>

